Programming With QuickTime Sprites

| Previous | Chapter Contents | Chapter Top | Next |

Registration Points

New in QuickTime 3 are sprite image registration points. These image registration points, shown in Figure 0-5 , define an offset which is applied to a sprite's source matrix. A sprite's default registration point is (0,0), or the top left of its source box.

Figure 5 Default sprite image registration points

When a sprite with a default registration point of (0,0) is translated to a location by setting the x and y translation elements of its source matrix, the sprite's upper left corner is placed at the given location. If a sprite's source box is 100 pixels wide and 100 pixels tall, then setting the sprite image's registration point to (50,50) causes the center of the sprite to be translated to the x and y translation of its source matrix. This also causes the wired sprite action kActionSpriteRotate to rotate the sprite about its center.

Figure 0-6 shows a default registration point in a sprite track's local coordinate system.

Figure 6 Default registration point in a sprite track's local coordinate system

If your animation is cell-based, your images may vary in size, so you may want the registration for the center in order for the images used by the sprites to line up correctly, as shown in Figure 0-7 . For example, if you have a sprite-displayed explosion, the first cells may be smaller than the last. By setting the registration point to the center of each image, the explosion animation will be centered at the sprite's location defined by its matrix.

Figure 7 Centered registration points

Figure 0-8 shows a centered registration point in a sprite track's local coordinate system.

Figure 8 A centered registration point in a sprite track's local coordinate system

When a sprite uses images of different sizes, you assign group IDs to the images. Group IDs are illustrated in the code sample in Appendix C.

Figure 0-9 shows an example of registration points in a QuickTime movie.

Figure 9 Registration points in a QuickTime movie

Figure 0-10 shows an example of centered registration points in a QuickTime movie.

Figure 10 Centered registration points in a QuickTime movie


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |